
#pragma once

#ifndef UDBSURF_H
#define UDBSURF_H

#include "zdbmain.h"
#include "zdbsubeid.h"
#include "zgepnt3d.h"
#include "zgevec3d.h"
#include "zdbbody.h"
#include "zdbRevolveOptions.h"
#include "zdbSweepOptions.h"
#include "zdbLoftOptions.h"

#pragma pack(push, 8)

class UcDbSurface: public UcDbEntity
{
public:
    UcDbSurface();
    virtual ~UcDbSurface();
    UCDB_DECLARE_MEMBERS(UcDbSurface);
    static Ucad::ErrorStatus createFrom ( const UcDbEntity* pFromEntity,
                                          UcDbSurface*& pNewSurface );
    virtual Ucad::ErrorStatus convertToRegion ( UcArray<UcDbEntity*>& regions );
    virtual Ucad::ErrorStatus thicken(double thickness,
        bool bBothSides, UcDb3dSolid*& pSolid) const;

	virtual Ucad::ErrorStatus createInterferenceObjects(UcArray<UcDbEntity*>& interferenceObjects, UcDbEntity* pEntity, unsigned int flags ) const;

	virtual Ucad::ErrorStatus booleanUnion(const UcDbSurface* pSurface2, UcDbSurface*& pNewSurface);
	virtual Ucad::ErrorStatus booleanSubtract(const UcDbSurface* pSurface2, UcDbSurface*& pNewSurface);
	virtual Ucad::ErrorStatus booleanSubtract(const UcDb3dSolid* pSolid, UcDbSurface*& pNewSurface);
	virtual Ucad::ErrorStatus booleanIntersect(const UcDbSurface* pSurface2, UcArray<UcDbEntity*>& intersectionEntities);
	virtual Ucad::ErrorStatus booleanIntersect(const UcDb3dSolid* pSolid, UcArray<UcDbEntity*>& intersectionEntities);
	virtual Ucad::ErrorStatus imprintEntity(const UcDbEntity* pEntity);
	virtual Ucad::ErrorStatus createSectionObjects(const UcGePlane& sectionPlane, UcArray<UcDbEntity*>& sectionObjects) const;
	virtual Ucad::ErrorStatus sliceByPlane(const UcGePlane& slicePlane,	UcDbSurface*& pNegHalfSurface, UcDbSurface*& pNewSurface);
	virtual Ucad::ErrorStatus sliceBySurface(const UcDbSurface* pSlicingSurface, UcDbSurface*& pNegHalfSurface,	UcDbSurface*& pNewSurface);
	virtual Ucad::ErrorStatus chamferEdges(const UcArray<UcDbSubentId *> &edgeSubentIds, const UcDbSubentId& baseFaceSubentId, double baseDist, double otherDist);
	virtual Ucad::ErrorStatus filletEdges(const UcArray<UcDbSubentId *> &edgeSubentIds,
		const UcGeDoubleArray& radius, 
		const UcGeDoubleArray& startSetback, 
		const UcGeDoubleArray& endSetback);
	virtual Ucad::ErrorStatus setSubentColor(const UcDbSubentId& subentId, const UcCmColor& color);
	virtual Ucad::ErrorStatus getSubentColor(const UcDbSubentId& subentId, UcCmColor& color) const;

	virtual Ucad::ErrorStatus setSubentMaterial(const UcDbSubentId& subentId, const UcDbObjectId& matId);
	virtual Ucad::ErrorStatus getSubentMaterial(const UcDbSubentId& subentId, UcDbObjectId& matId) const;

	virtual Ucad::ErrorStatus setSubentMaterialMapper(const UcDbSubentId& subentId,	const UcGiMapper& mapper);
	virtual Ucad::ErrorStatus getSubentMaterialMapper(const UcDbSubentId& subentId,	UcGiMapper& mapper) const;

    virtual Ucad::ErrorStatus getArea(double& area) const;

	UCDB_PORT virtual void dragStatus(const UcDb::DragStat);
	virtual void* ZSMBodyCopy(bool bDeepCopy = false) const;      
	virtual void const *      getLockedZSMBody();                 
	virtual void              unlockZSMBody();                    
	virtual void*             getLockedWritableZSMBody();         
	virtual void              commitWritableZSMBody();            
	virtual Ucad::ErrorStatus setZSMBody(const void* modelerBody);


    virtual UcDbSubentId internalSubentId(void* ent) const;
    virtual void* internalSubentPtr(const UcDbSubentId& id) const;
    virtual void list() const;

	virtual Ucad::ErrorStatus dwgInFields(UcDbDwgFiler* pFiler);
	virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler* pFiler) const;
	virtual Ucad::ErrorStatus dxfInFields(UcDbDxfFiler* pFiler);
	virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler* pFiler) const;
	virtual Ucad::ErrorStatus getClassID(CLSID* pClsid) const;

    virtual ZSoft::UInt16       uIsolineDensity() const;
    virtual Ucad::ErrorStatus   setUIsolineDensity(ZSoft::UInt16 numIsolines);

    virtual ZSoft::UInt16       vIsolineDensity() const;
    virtual Ucad::ErrorStatus   setVIsolineDensity(ZSoft::UInt16 numIsolines);

	virtual Ucad::ErrorStatus getPlane(UcGePlane& plane, UcDb::Planarity& planarity) const;
	UCDB_PORT virtual bool usesGraphicsCache();
};

#pragma pack(pop)

#endif 
